package com.lm.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

@Aspect  //标注这个类是一个切面
public class LogAspect {

    @Pointcut("execution(* com.lm.service.*.*(..))")
    public void pointcut(){
    }

    @Before("pointcut()")
    public void before(){
        System.out.println("before...");
    }

    @After("execution(* com.lm.service.*.*(..))")
    public void after(){
        System.out.println("after...");
    }

    //在环绕增强中，我们可以给地暖管一个参数，代表我们要获取切入的点
    @Around("execution(* com.lm.service.*.*(..))")
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("before around...");

        Object proceed = joinPoint.proceed();

        System.out.println("after around...");
        return proceed;
    }

}
